package com.mxl.service.cashorder.rule;

import com.mxl.common.StringUtil;
import com.mxl.common.helper.DirectFlag;
import com.mxl.common.rule.AbstractRule;
import com.mxl.service.cashorder.dto.CashOrderRequest;

/**
 * 判断是否直连  卡号或者卡密为空 非直连
 * @author Administrator
 *
 */
public class DirectLinkCheck extends AbstractRule {

	@Override
	protected boolean makeDecision(Object obj) throws Exception {
		CashOrderRequest c = (CashOrderRequest) obj;
		if (StringUtil.isEmpty(c.getCardNo())
				|| StringUtil.isEmpty(c.getCardPwd())) {
			c.setDirectFlag(DirectFlag.DIRECT_NO.getValue());
			return false;
		}
		c.setSelectAmount(c.getOrderAmount());
		//直连的选择金额是订单金额
		c.setDirectFlag(DirectFlag.DIRECT.getValue());
		return true;
	}

}
